package ani.trainning.cacobatph.das;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import ani.trainning.cacobatph.R;

public class SimpleAdapterListError extends BaseAdapter{

	private final Context context;
	private final List<String> errors;
	private final LayoutInflater layoutInflater;

	public SimpleAdapterListError (Context context,List<String>errors){
		this.context=context;
		this.errors=errors;
		this.layoutInflater=LayoutInflater.from(context);}


	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public Object getItem(int arg0) {
		return errors.get(arg0);
	}

	@Override
	public int getCount() {
		return errors.size();
	}

	public static  class Holder {
		TextView text1;


	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		Holder holder;
		if(convertView==null){
			convertView=layoutInflater.inflate(R.layout.item_list_errors_das, null);
			holder=new Holder();
			holder.text1=(TextView) convertView.findViewById(R.id.textItemError);
			convertView.setTag(holder);
		}
		else{
			holder=(Holder) convertView.getTag();

		}
		holder.text1.setText(errors.get(position));
		return convertView;
	}


}
